package com.groupfour.attendancemanagementsystem.utils;

import javax.servlet.http.HttpServletRequest;

public class AuthContextHolder {

    //从请求头token获取userCode
    public static String getUserCodeToken(HttpServletRequest request) {
        //从请求头token
        String token = request.getHeader("token");
        //调用工具类
        String userCode = JwtHelper.getUserCode(token);
        return userCode;
    }

    //从请求头token获取userPassword
    public static String getUserPassword(HttpServletRequest request) {
        //从header获取token
        String token = request.getHeader("token");
        //jwt从token获取username
        String userPassword = JwtHelper.getUserPassword(token);
        return userPassword;
    }
}
